<template>
  <div>
    <h1 class="title">{{ articleInfo. title }}</h1>
    <div class="info">
      <span>作者：{{ articleInfo.nickname || articleInfo.username }}</span>
      <span>发布时间：{{ articleInfo.pub_date | dateFormat }}</span>
      <span>所属分类： {{ articleInfo.cate_name }}</span>
      <span>状态：{{ articleInfo.state }}</span>
    </div>
    <el-divider></el-divider>
    <!--  cover_img 返回的是服务的/uploads/文件-->
    <img :src="'http://www.liulongbin.top:3008' + articleInfo.cover_img" alt="" />
    <div v-html="articleInfo.content"></div>
  </div>
</template>

<script>
export default {
  name: 'ArtInfo',
  props: {
    // 子组件接收父组件传递的文章信息
    articleInfo: {
      type: Object,
      required: true
    }
  }
}
</script>

<style lang="less" scoped>
.title {
  font-size: 24px;
  text-align: center;
  font-weight: normal;
  color: #000;
  margin: 0 0 10px 0;
}

.info {
  font-size: 12px;
  span {
    margin-right: 20px;
  }
}
</style>
